package cloud.xlh.infrastructure.mq.rabbitmq;

import cloud.xlh.infrastructure.mq.EventDealReqMsg;
import cloud.xlh.infrastructure.mq.Producer;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created with IntelliJ IDEA.
 *
 * @ project name : xlh_osms
 * @ Author: XuLeHuang
 * @ Date: 2023/2/14 9:44
 * @ Description:
 */
public class RabbitMQProducer implements Producer {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    /**
     *
     * @param eventDealReqMsg
     * @param aClass
     * @param objects
     * @return void
     * @author XuLeHuang
     * @create 2023/2/14
     * @name:
     * @Description:
     **/
    @Override
    public void registerEvent(EventDealReqMsg eventDealReqMsg, Class aClass, Object... objects) {
        rabbitTemplate.convertAndSend(eventDealReqMsg.getPatternKey() , eventDealReqMsg.getRoutingKey() , eventDealReqMsg);
    }
}
